package banking;
public class Account {          //建立一个类
	 private double   balance;    // 建立私有变量余额
  public Account(Double d) {     //读取用户信息
	  balance =d;        //将用户名存到
  }
  public double getBalance() {        //返回此时balance值
    return balance;
  }
  public boolean deposit(double amount) {     
    balance = balance + amount;                   //存款：把金额加到balance余额里面
    return true;                                     //返回成功
  }
  public boolean withdraw(double amount) {        //取款
    boolean result = true;                       //对result进行初始化
    if ( balance < amount ) {                   //如果存款不够取款金额
      result = false;                        //则结果为false
    } else {  
      balance = balance - amount;                    //其他则更正余额
    }
    return result;                              //返回result结果
 }
}
